"use strict";
;
var UserInfo = /** @class */ (function () {
    function UserInfo(name, storage) {
        this.name = name;
        this.storage = storage;
        this.name = name;
    }
    ;
    UserInfo.prototype.save = function () {
        this.storage.save(this.name, JSON.stringify(this));
    };
    ;
    UserInfo.prototype.read = function () {
        return this.storage.read(this.name);
    };
    return UserInfo;
}());
;
var LocalStorage = /** @class */ (function () {
    function LocalStorage() {
    }
    LocalStorage.prototype.save = function (key, value) {
        console.log('localStorage.setItem', key, value);
        localStorage.setItem(key, value);
    };
    ;
    LocalStorage.prototype.read = function (key) {
        console.log('localStorage.getItem', key);
        return localStorage.getItem(key);
    };
    return LocalStorage;
}());
;
var local = new LocalStorage();
var userInfo = new UserInfo('小明', local);
//存信息
userInfo.save();
// 取信息
var res4 = userInfo.read();
console.log('取信息', res4);
